home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / PDOS / TN.PDOS.028 < prev    next >
Encoding:
Text File  |  1990-09-21  |  3.6 KB  |  110 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. ProDOS 8
  7. #28:    ProDOS Dates--2000 and Beyond
  8.  
  9. Written by:    Dave Lyons    September 1990
  10.  
  11. This Technical Note explains how ProDOS year values range from zero to ninety-
  12. nine and represent the years 1940 through 2039.
  13. _____________________________________________________________________________
  14.  
  15. The ProDOS date format uses sixteen bits:  seven bits for the year, four for 
  16. the month, and five for the day (see the ProDOS 8 Technical Reference Manual, 
  17. page 71).  Dates are represented in this format in the parameter blocks for 
  18. ProDOS 8 MLI calls and in the directories of ProDOS volumes.
  19.  
  20. In seven bits, 128 different years could be represented, but the proper 
  21. interpretation of those bits has never been defined clearly until now.
  22.  
  23.  
  24. 2000? I'll Be Dead By Then Anyway
  25.  
  26. It's only nine years, folks, and then things get weird.  Is that ProDOS year 
  27. 100 or ProDOS year 0?  How do you compare two file-modification dates so it 
  28. keeps working correctly?
  29.  
  30. Before you dismiss questions like this, consider just how sure you are that 
  31. nobody will be using your software in nine years, or whether those few 
  32. dedicated weirdos are going to call you up on January 1, 2000 to complain.  
  33. There will be plenty of computer-related problems in 2000, so write your 
  34. applications right today.
  35.  
  36.  
  37. Some Choices
  38.  
  39. These two possible interpretations were considered and then rejected in favor 
  40. of The Definition below.
  41.  
  42.   1.  Valid years would be from 0 to 99, meaning 1900 to 1999, so ProDOS dates 
  43.       would just "expire" at the end of 1999.  No fun.
  44.  
  45.   2.  Valid years would be from 0 to 127, meaning 1900 to 2027.  This is a 
  46.       little better, except that almost no existing software is prepared to 
  47.       deal with year values outside the 0-to-99 range.
  48.  
  49. So, you are left with...
  50.  
  51.  
  52. The Definition
  53.  
  54. The following definition allows the same range of years that the Apple IIgs 
  55. Control Panel CDA currently does:
  56.  
  57.   o  A seven-bit ProDOS year value is in the range 0 to 99
  58.      (100 through 127 are invalid)
  59.   o  Year values from 40 to 99 represent 1940 through 1999
  60.   o  Year values from 0 to 39 represent 2000 through 2039
  61.  
  62. Note:  Apple II and Apple IIgs System Software does not currently reflect 
  63.        this definition.
  64.  
  65.  
  66. How to Compare Two Years
  67.  
  68. To compare two dates, you need to adjust the years to allow for the wrap-
  69. around effect between 39 and 40.  A simple approach is to add 100 to any year 
  70. less than 40 before doing the comparison, thus comparing two values in the 
  71. range 40 to 139.
  72.  
  73.     CompareAB    lda YearB
  74.                  cmp #40
  75.                  bcs B_OK
  76.                  adc #100    ;carry is clear
  77.                  sta YearB
  78.  
  79. B_OK             lda YearA
  80.                  cmp #40
  81.                  bcs A_OK
  82.                  adc #100    ;carry is clear
  83.                  sta YearA
  84.  
  85. A_OK             cmp YearB
  86.                  bcc A_is_earlier
  87.                  ...
  88.  
  89.  
  90. What About GS/OS Dates?
  91.  
  92. This definition affects how the GS/OS ProDOS File System Translator works 
  93. internally, but it does not affect GS/OS applications.  A year value under 
  94. GS/OS is always a byte offset from 1900, giving a possible range of 1900 to 
  95. 2155, regardless of the file system involved.
  96.  
  97.  
  98. What Do You Do After 2039?
  99.  
  100. Apple is still working on it.  Contact your neighborhood Apple Developer 
  101. Technical Support office in 2030.
  102.  
  103.  
  104. Further Reference
  105. _____________________________________________________________________________
  106.   o  ProDOS 8 Technical Reference Manual
  107.   o  Apple IIgs Toolbox Reference Manual, Volume 1
  108.   o  GS/OS Reference
  109.  
  110.